useFixture(default)

def test():
	from Modules import commonBits
	java_recorded_version = '1.5.0_11'

	if window('Protocol Buffer Editor'):
		select('FileChooser', commonBits.sampleDir() + 'protoSales.bin')
		click('Edit1')
		select_menu('View>>Sorted Field Tree')
		##select('List', 'sale')
		select('Table', 'store', 'Field,0')
		select('Table', 'department', 'Field,1')
		select('Table', 'cell:Field,1(department)')
		click('Build Tree')
		#select('JTreeTable', '')
		rightclick('JTreeTable', 'keycode,1')
		select_menu('Expand Tree')
		select('JTreeTable', 'cell:Tree,4(null)')
		assert_p('JTreeTable', 'RowCount', '10')
		select('JTreeTable', 'cell:Tree,3(null)')
		select_menu('View>>Table View #{Selected Records#}')
		select('JTreeTable', 'cell:Tree,3(null)')
		select('Table', 'cell:2|store,0(59)')
		assert_p('Table', 'Content', '[[68634752, 59, 410, 40118, 1, 8990]]')
		select('Table', 'cell:2|store,0(59)')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		select('JTreeTable', 'rows:[4,6],columns:[Tree]')
		select_menu('View>>Table View #{Selected Records#}')
		select('JTreeTable', 'rows:[4,6],columns:[Tree]')
		select('Table', 'cell:2|store,1(59)')
		select('Table', 'cell:4|saleDate,0(40118)')
		assert_p('Table', 'Content', '[[60694698, 59, 620, 40118, 1, 3990], [60664659, 59, 620, 40118, 1, 3990], [67674686, 59, 929, 40118, 1, 3990]]')

		select('Table', 'cell:4|saleDate,0(40118)')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		select('JTreeTable', 'rows:[4,6],columns:[Tree]')
		rightclick('JTreeTable', 'keycode,3')
		select_menu('Expand Tree')
		#select('JTreeTable', '')
		rightclick('JTreeTable', 'keycode,6')
		select('JTreeTable', 'cell:keycode,4(68634752)')
		select('JTreeTable', 'cell:keycode,4(68634752)')
		assert_p('JTreeTable', 'Content', '[[, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , 68634752, 59, 410, 40118, 1, 8990], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ]]')
		select('JTreeTable', 'cell:keycode,6(null)')
		rightclick('JTreeTable', 'keycode,6')
		select_menu('Expand Tree')
		#select('JTreeTable', '')
		rightclick('JTreeTable', 'keycode,10')
		select_menu('Expand Tree')
		select('JTreeTable', 'cell:keycode,12(64614401)')
		assert_p('JTreeTable', 'Content', '[[, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , 68634752, 59, 410, 40118, 1, 8990], [, , , , , , , ], [, , , , , , , ], [, , 60614487, 59, 878, 40118, 1, 5950], [, , 63644339, 59, 878, 40118, 1, 12650], [, , , , , , , ], [, , , , , , , ], [, , 64614401, 59, 957, 40118, 1, 1990], [, , 64614401, 59, 957, 40118, 1, 1990], [, , 62684217, 59, 957, 40118, 1, 9990], [, , 64624770, 59, 957, 40118, 1, 2590], [, , , , , , , ], [, , , , , , , ]]')

		select('JTreeTable', 'cell:keycode,13(62684217)')
		assert_p('JTreeTable', 'RowCount', '17')
		select('JTreeTable', 'rows:[4,7,12,14],columns:[keycode]')
		select_menu('View>>Table View #{Selected Records#}')
		select('JTreeTable', 'rows:[4,7,12,14],columns:[keycode]')
		select('Table', 'cell:2|store,1(59)')
		assert_p('Table', 'Content', '[[68634752, 59, 410, 40118, 1, 8990], [60614487, 59, 878, 40118, 1, 5950], [64614401, 59, 957, 40118, 1, 1990], [64624770, 59, 957, 40118, 1, 2590]]')

		select('Table', 'cell:1|keycode,3(64624770)')
		assert_p('Table', 'Text', '59', '2|store,3')
		select('Table', 'cell:1|keycode,3(64624770)')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		select_menu('View>>Table View #{Selected Records#}')
		select('Table', 'cell:2|store,1(59)')
		assert_p('Table', 'Content', '[[68634752, 59, 410, 40118, 1, 8990], [60614487, 59, 878, 40118, 1, 5950], [64614401, 59, 957, 40118, 1, 1990], [64624770, 59, 957, 40118, 1, 2590]]')

		select('Table', 'cell:2|store,1(59)')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		select('JTreeTable', 'rows:[2,9,11],columns:[Tree]')
		select_menu('View>>Table View #{Selected Records#}')
		select('JTreeTable', 'rows:[2,9,11],columns:[Tree]')
		select('Table', 'cell:2|store,2(59)')
		assert_p('Table', 'Content', '[[61664713, 59, 335, 40118, 1, 17990], [61664713, 59, 335, 40118, -1, -17990], [61684613, 59, 335, 40118, 1, 12990], [67674686, 59, 929, 40118, 1, 3990], [64614401, 59, 957, 40118, 1, 1990]]')

	close()
